<template>
  <div class="introduce">
    <div class="introduce-header">
      <div class="title">
        {{detail.courseName}}
      </div>
      <div class="info">
        <div class="buy-info">
          <div class="price">
            <span class="unit">￥</span>
            <span class="price-txt">{{detail.coursePrice}}</span>
          </div>
          <div class="original-price">
            ￥{{detail.courseNewPrice}}
          </div>
          <div class="buy-count">{{detail.buyNum}}人买过</div>
        </div>
        <div class="course-info">
          {{detail.isEnd ? '已完结' : '更新中'}} / {{detail.totalChapter}}讲
        </div>
      </div>
      <div class="alert">
        <div class="icon"></div>
        <div class="alert-content">您已开通会员，可免费畅听该课程</div>
      </div>
      <div class="has-author">
        <div class="author-icon">圈</div>
        <div class="author-content">订阅讲师技术圈，可免费学习该课程</div>
      </div>
    </div>
    <div class="introduce-body">
      <div class="title">讲师介绍</div>
      <div class="teacher">
        <div class="teacher-avatar">
          <van-image :src="teacher.headPortrait" round></van-image>
        </div>
        <div class="teacher-info">
          <div class="name">{{teacher.nickname}}</div>
          <div class="teacher-desc">
            {{teacher.introduction}}
          </div>
        </div>
      </div>
    </div>
    <div class="course-detail" v-html="detail.image">

    </div>
  </div>
</template>

<script>
export default {
  props: {
    detail: Object,
    teacher: Object
  }
}
</script>

<style scoped>
.introduce-header {
  padding: 20px;
}
.introduce-header .title {
  font-size: 18px;
  font-weight: bold;
}

.info {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
}

.info .buy-info {
  display: flex;
  align-items: flex-end;
}

.price {
  color: #fe6d1d;
  margin-right: 3px;
  line-height: 1;
}

.price .unit {
  font-size: 12px;
}

.price .price-txt {
  font-size: 20px;
}

.original-price {
  color: #d2d2d2;
  font-size: 12px;
  margin-right: 5px;
  text-decoration: line-through;
}

.buy-count {
  font-size: 12px;
  color: #b2b2b2;
}

.course-info {
  font-size: 12px;
  color: #464646;
}

.alert {
  background: #efcf9e;
  height: 32px;
  border-radius: 3px;
  padding: 0 9px;
  display: flex;
  align-items: center;
}

.icon {
  display: block;
  width: 12px;
  height: 12px;
  background: url('../../assets/static/course/icon-vip.png') center center / cover;
  margin-right: 14px;
}

.alert-content {
  color: #333;
  font-size: 12px;
}

.has-author {
  margin-top: 10px;
  display: flex;
}

.author-icon {
  margin-right: 8px;
  color: #fff;
  background-color: #ff0000;
  width: 18px;
  height: 18px;
  font-size: 12px;
  text-align: center;
  line-height: 18px;
}

.author-content {
  font-size: 12px;
  color: #fe6d1d;
}

.introduce-body {
  padding: 20px;
  padding-top: 0;
  border-top: 10px solid #eee;

}

.course-detail {
  border-top: 10px solid #eee;
  padding: 0 20px 20px 20px;
}

.introduce-body .title {
  padding: 10px 0;
  font-size: 16px;
}

.teacher {
  display: flex;
  align-items: center;
}

.teacher-avatar {
  width: 64px;
  height: 64px;
  margin-right: 15px;
  flex-shrink: 0;
}

.teacher-info .name {
  font-size: 16px;
  font-weight: bold;
  color: #333;
}

.teacher-info .teacher-desc {
  font-size: 12px;
  color: #aaa;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
</style>